package com.xpchenfrank.test.duoxiancheng;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author xpchen
 * @time 2018/4/27 15:32
 * @Description
 * @copyright Wuxi Yazuo ,Ltd.copyright 2015-2025
 */
public class Tread {

    public static void main(String[] args) {
        ExecutorService service = Executors.newFixedThreadPool(10);

        final CountDownLatch latch = new CountDownLatch(5);
        for (int i = 0; i < 5; i++) {
            service.execute(new Runnable() {
                @Override
                public void run() {
                    System.out.println("hello");
                    latch.countDown();
                }
            });
        }

        try {
            latch.await();
        } catch (InterruptedException e) {
            //e.printStackTrace();
        }
        service.shutdownNow();
        System.out.println("over!!");
    }
}

